package com.example.martian.controller;

import com.example.martian.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;

@Controller
@RequestMapping("/index/")
@CrossOrigin
public class IndexController {

    @Autowired
    private IndexService indexService;

    //币种展示
    @RequestMapping(value = "showCoin")
    @ResponseBody
    public Object showCoin(){
        return indexService.showCoin();
    }

    //汇率查询 + 闪兑展示
    @RequestMapping(value = "showExchange")
    @ResponseBody
    public Object showExchange(String symbol){
        return indexService.showExchange(symbol);
    }

    //闪兑
    @RequestMapping(value = "exchange")
    @ResponseBody
    public Object exchange(String exchangeRate, Integer jypassword, String address, String service_charge,
                           BigDecimal exchangeMoney, String coin, String getCoin){
        return indexService.exchange(exchangeRate, jypassword, address, service_charge, exchangeMoney, coin, getCoin);
    }

    //轮播图
    @RequestMapping(value = "getBannerList")
    @ResponseBody
    public Object getBannerList(){
        return indexService.getBannerList();
    }
}
